function spf_smooth = expan_spectral_flux_smooth(spf, treshold)

inv_spf = (1-spf)';

spf_pk_env = expan_peak_env(inv_spf');

for i=1:length(inv_spf)
    if (inv_spf(i) < treshold)
        spf_smooth(i) = inv_spf(i);
    else
        spf_smooth(i) = spf_pk_env(i); 
    end
end
